#ifndef __CROSSFIRE_LANDSCAPE
#define __CROSSFIRE_LANDSCAPE

struct SCF_LandscapeVertex
{
  D3DXVECTOR3 Point;
  D3DXVECTOR2 UV;
  //DWORD Color;

  SCF_LandscapeVertex( float x, float y, float z, float u, float v )
  {
    Point.x = x;
    Point.y = y;
    Point.z = z;

    UV.x = u;
    UV.y = v;
  }
};

#define LANDSCAPE_VERTEX_FVF (D3DFVF_XYZ | D3DFVF_TEX1)

class CCF_Landscape : CCF_EngineElement
{
private:
	LPDIRECT3DDEVICE9 m_pDevice;
	LPDIRECT3DTEXTURE9 m_pTexture;
	LPDIRECT3DVERTEXBUFFER9 m_pVb;
	LPDIRECT3DINDEXBUFFER9 m_pIb;

	int m_iNumPolys;
	int m_iNumVertices;

	float m_fStepWidth;
	float m_fStepLength;
	float m_fHeightScale;

	int   m_Columns;
	int   m_Rows;

	UINT m_FVF_XYZ_DIFFUSE; 

	D3DXVECTOR3 m_vPos;
public:

	CCF_Landscape();
	~CCF_Landscape();

	BOOL Initialize( LPDIRECT3DDEVICE9 device,
		int nSize,
		LPCWSTR szHeightMapFile,
		LPCWSTR szTextureMapFile,
		float fStepWidth,
		float fStepLength,
		float fHeightScale);

	void SetTexture(const LPWSTR Texture);
	void SetTranslate(D3DXVECTOR3 Pos);
	void Render(void);
private:
	void Build3DBuffers();
};



#endif